package com.example.demomybatis.service.impl;

import com.example.demomybatis.entity.Student;
import com.example.demomybatis.mapper.StudentMapper;
import com.example.demomybatis.mapper.StudentMapper;
import com.example.demomybatis.service.StudentService;
import com.example.demomybatis.service.StudentService;
import com.example.demomybatis.vo.RequestStudentPr;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class StudentServiceImpl implements StudentService {

    @Autowired
    StudentMapper studentMapper;



    @Override

    public Student addStudent(Student student) {
        studentMapper.addStudent(student);
        return student;
    }

    @Override
    public Integer updateStudent(Student student) {
        Integer result = studentMapper.updateStudent(student);
        return result;
    }

    @Override
    public List<Student> selectStudent(RequestStudentPr requestStudentPr) {
        List<Student> studentList = studentMapper.selectStudent(requestStudentPr);
        return studentList;
    }

    @Override

    public Integer deleteStudent(Integer studentId) {
        //根据ID删除记录
        Integer result = studentMapper.deleteStudent(studentId);
        return result;
    }

    @Override

    public Student selectOneStudent(Integer studentId) {
        return studentMapper.selectOneStudent(studentId);
    }

    @Override
    public Integer selectCountStudent(RequestStudentPr requestStudentPr) {
        return studentMapper.selectCountStudent(requestStudentPr);
    }
}
